/*
 * Transform.cpp
 *
 *  Created on: 28 Oct 2012
 *      Author: guy
 */

#include "Transform2D.h"

using namespace SolidityEngine;

Transform2D::Transform2D():
    Component(),
    _position(Vector2D::Zero()),
    _rotation(Matrix2D::Identity())
{
    //do nothing
}

const Vector2D Transform2D::Position() const{
	return _position;
}

Vector2D& Transform2D::Position(){
	return _position;
}

void Transform2D::Translate(const Vector2D& vector){
    _position=_position+vector;
}

void Transform2D::Rotate(float angle){
    _rotation=_rotation+Matrix2D::Rotation(angle);
}

void Transform2D::TranslateLocal(const Vector2D& vector){
    _position=_position+(_rotation*vector);
}

Transform2D* Transform2D::_Clone(){
    return new Transform2D(*this);
}

